package cn.qidd.keep.manage.model.system;

import cn.qidd.keep.domain.document.QRole;
import cn.qidd.keep.domain.model.BaseSearch;
import com.querydsl.core.BooleanBuilder;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

/**
 * Created by sunyanping on 2018/9/17
 */
@Data
public class RoleSearchParams extends BaseSearch {
    @ApiModelProperty("角色名称")
    private String roleName;

    @Override
    public BooleanBuilder generateSearchCondition() {
        BooleanBuilder builder = new BooleanBuilder();
        QRole qMongoRole = QRole.role;
        if (StringUtils.isNoneBlank(this.roleName)) {
            builder.and(qMongoRole.roleName.like("%"+this.roleName+"%"));
        }
        return builder;
    }
}
